package cn.wolfcode.wolf2w.job;


import cn.wolfcode.wolf2w.redis.IStrategyStatisVORedisService;
import cn.wolfcode.wolf2w.redis.vo.StrategyStatisVO;
import cn.wolfcode.wolf2w.service.IStrategyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;

//@Component
public class RedisDataPersistenceJob {

    @Autowired
    private IStrategyService strategyService;

    @Autowired
    private IStrategyStatisVORedisService strategyStatisVORedisService;


    @Scheduled(cron = "0/10 * * * * ?")
    public void work(){

        List<StrategyStatisVO> vo = strategyStatisVORedisService.queryStrategyVoByPattern("*");

        for (StrategyStatisVO statisVO : vo) {

            strategyService.updateVo(statisVO);
        }
    }

}
